package com.openspring.baseinfo.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import com.openspring.baseinfo.dao.DistrictDAO;
import com.openspring.baseinfo.model.District;
import com.openspring.framework.dao.AbstractSpringGenericDAO;
import com.openspring.framework.extend.spring.EntityPropertyRowMapper;

@Repository("districtDAO")
public class DistrictDAOImpl extends AbstractSpringGenericDAO<District, Long> implements DistrictDAO {

	@Override
	public List<District> queryChildren(Long parentId) {
		String sql = "SELECT * FROM emp.t_baseinfo_district WHERE \"parentId\" = ? ORDER BY sort";
		return getJdbcTemplate().query(sql, new EntityPropertyRowMapper<District>(District.class), parentId);
	}

}
